Skip to content

feat: mutiple backends for recipes #3114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jeffmaury
Copy link
Collaborator

Fixes #3006

Signed-off-by: Jeff MAURY [email protected]

What does this PR do?

Allow association from recipe to multiple backends

Screenshot / video of UI

N/A

What issues does this PR fix or reference?

#3006

How to test this PR?

Start recipes. You should be a able to start recipes with an OpenVINO model

@jeffmaury jeffmaury requested review from benoitf and a team as code owners June 2, 2025 15:16
@jeffmaury jeffmaury requested review from dgolovin, cdrage and gastoner June 2, 2025 15:16
Copy link
Contributor

@gastoner gastoner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried 2 recipes (with backend and backends):
backends: all works as expected ✔️

When selecting recipe with just "backed"

Screencast_20250603_080529.webm

I'm unable to see any models (guessing that backend should be backends)

basedir: 'recipes/natural_language_processing/chatbot',
readme: '',
recommended: ['hf.instructlab.granite-7b-lab-GGUF', 'hf.instructlab.merlinite-7b-lab-GGUF'],
backend: 'llama-cpp',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldnt this be also backends: ['llama-cpp'] ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not mandatory because it will be parsed but updated for consistency

@@ -166,7 +166,7 @@
"hf.instructlab.merlinite-7b-lab-GGUF",
"hf.lmstudio-community.granite-3.0-8b-instruct-GGUF"
],
"backend": "llama-cpp",
"backend": ["llama-cpp", "openvino"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldnt there be also backends like if I have an array -> backedns

@jeffmaury jeffmaury requested a review from gastoner June 3, 2025 07:20
Copy link
Contributor

@gastoner gastoner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines +333 to 336
.flatMap(r => r.backends)
.filter(b => b !== undefined)
.filter((value, index, array) => array.indexOf(value) === index)
.sort((a, b) => a.localeCompare(b))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remark (non-blocking): non related to this PR, but this filtering chain is unreadable, what is r ? what is b?, what is the type of value, what is the type of a and b? :/

Comment on lines +293 to +297
let res: Recipe[] = [];
for (const value of values) {
res = [...res, ...result.filter(r => r.backends?.includes(value))];
}
result = res;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: I don't understand what this code is doing? can we add a comment? filtering result? shallow copy?

@@ -42,7 +42,7 @@ let startedContainerProviderConnectionInfo: ContainerProviderConnectionInfo[] =
let localPath: LocalRepository | undefined = $derived(findLocalRepositoryByRecipeId($localRepositories, recipe?.id));
// Filter all models based on backend property
let models: ModelInfo[] = $derived(
$modelsInfo.filter(model => (model.backend ?? InferenceType.NONE) === (recipe?.backend ?? InferenceType.NONE)),
$modelsInfo.filter(model => recipe?.backends?.includes(model.backend ?? InferenceType.NONE)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: I would be more confortable adding an unit test in StartRecipe.spec.ts where we have a recipe with several backends, to ensure we properly display all models matching the backends listed.

@@ -42,7 +42,7 @@ let startedContainerProviderConnectionInfo: ContainerProviderConnectionInfo[] =
let localPath: LocalRepository | undefined = $derived(findLocalRepositoryByRecipeId($localRepositories, recipe?.id));
// Filter all models based on backend property
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update comment?

Copy link
Contributor

@axel7083 axel7083 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comment, currently trying it locally on Windows 11, good job otherwise 👍

Signed-off-by: Jeff MAURY <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A recipe shoud be associated with several backends
3 participants